/**
 * This file is released under the GNU General Public License.
 * Refer to the COPYING file distributed with this package.
 *
 * Copyright (c) 2008-2009 WURFL-Pro srl
 */
package net.sourceforge.wurfl.core.resource;

import net.sourceforge.wurfl.core.WURFLRuntimeException;

import org.apache.commons.lang.text.StrBuilder;

/**
 * The device is not managed by model.
 * 
 * <p>
 * This exception is thrown if the referenced device is not managed by model.
 * </p>
 * 
 * @author WURFL-PRO SRL, Rome, Italy
 * @version $Id: DeviceNotInModelException.java 1045 2009-03-09 15:52:53Z filippo.deluca $
 */
public class DeviceNotInModelException extends WURFLRuntimeException {

	/** serial */
	private static final long serialVersionUID = 10L;

	/** The unmanaged ModelDevice */
	private ModelDevice modelDevice;

	/**
	 * Build DeviceNotInModelException by source ModelDevice.
	 * 
	 * @param modelDevice
	 *            The exception source.
	 */
	public DeviceNotInModelException(ModelDevice modelDevice) {
		super(new StrBuilder("Device: ").append(modelDevice.getID()).append(
				" is not managed by model").toString());

		this.modelDevice = modelDevice;
	}

	/**
	 * Returns the held ModelDevice source of this exception.
	 * 
	 * @return Not defined ModelDevice.
	 */
	public ModelDevice getModelDevice() {
		return modelDevice;
	}

}
